import MovePlayerEvent from "./move_player.js";
runOnStartup(async runtime => {
    // runtime.addEventListener("tick", () => tick())
    // runtime.getLayout("MainLevel").addEventListener("afterlayoutstart", () => init())
    window.addEventListener("levelInit", () => {
        CameraLockEvent.init()
    })
    window.addEventListener("levelTick", () => {
        CameraLockEvent.SetCameraPositionAndAngel()
    })
});
// function tick() {
//     if (runtime.layout.name != "MainLevel") return;
//     CameraLockEvent.SetCameraPositionAndAngel()
// }
// function init() {
//     CameraLockEvent.init()
// }
class CameraLockEvent {
    static init() {
        /**@type {I3DCameraObjectType} */
        this.Camera3Dinstance = runtime.objects.DCamera
    }
    static SetCameraPositionAndAngel() {
        if (Camear_CameraShke.isshake) return
        let camX = runtime.layout.width / 2
        let camY = runtime.layout.height / 2 + 360
        let camZ = 100
        let lookX = MovePlayerEvent.playerMask?.x
        let lookY = MovePlayerEvent.playerMask?.y
        let lookZ = 8
        let upX = 0
        let upY = 0
        let upZ = 1
        this.Camera3Dinstance.lookAtPosition(camX, camY, camZ, lookX, lookY, lookZ, upX, upY, upZ)
    }
}
export default CameraLockEvent;
